Conditions | 5 |
Paths | 4 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
15 | 5 | exports.formatDates = (model, formatString, utcOffset) => { |
|
16 | 275 | if (model instanceof Array) { |
|
17 | 64 | return model.map(item => exports.formatDates(item, formatString, utcOffset)); |
|
18 | 244 | } else if (model instanceof Date || model instanceof moment) { |
|
19 | 67 | return exports.formatDate(model, formatString, utcOffset); |
|
20 | 177 | } else if (model instanceof Object) { |
|
21 | 33 | const result = {}; |
|
22 | 193 | Object.keys(model).forEach((key) => { result[key] = exports.formatDates(model[key], formatString, utcOffset); }); |
|
23 | 33 | return result; |
|
24 | } |
||
25 | 144 | return model; |
|
26 | }; |
||
27 | |||
44 |